#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5e5 + 10;
ll a[N], td[N], tid[N];
int n, m;

int lowbit(int x) { return x & -x; }

void update(int k, ll x) {
	for (int i = k; i <= n; i+=lowbit(i)) td[i] += x, tid[i] += k*x;
}

ll getsum(int k) {
	ll res = 0;
	for (int i = k; i >= 1; i -= lowbit(i)) res += (k + 1) * td[i] - tid[i];
	return res;
}

void solve() {
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i];
	for (int i = 1; i <= n; i++) update(i, a[i]), update(i + 1, -a[i]);
	while (m--) {
		int op; cin >> op;
		if (op == 1) {
			ll x, y, k; cin >> x >> y >> k;
			update(x, k), update(y + 1, -k);
		}
		else {
			int x; cin >> x;
			cout << getsum(x)-getsum(x-1) << '\n';
		}
	}

}
int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	solve();
	return 0;
}